package hang.study.uistudy;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

/**
 * Created by Administrator on 2015/10/28.
 */
public class TestForResultActivity extends Activity {

    Button btn;
    EditText ettCity;

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if(requestCode == 0 && resultCode == 0){
            Bundle bundle = data.getExtras();
            String resultCity = bundle.getString("city");
            ettCity.setText(resultCity);
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.test_for_result_layout);

        btn = (Button)findViewById(R.id.btnSelect);
        ettCity = (EditText)findViewById(R.id.ettCity);

        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(TestForResultActivity.this,TestSelectCityActivity.class);
                startActivityForResult(intent,0);
            }
        });
    }
}
